<%@ page contentType="text/html;charset=UTF-8" language="java"  pageEncoding="utf-8"%> 
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="page" uri="/WEB-INF/page"%>
<%@page isELIgnored="false"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
    <link href="${pageContext.request.contextPath}/static/assets/css/bootstrap.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/css/font-awesome.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/css/custom-styles.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/js/dataTables/dataTables.bootstrap.css" rel="stylesheet" />
</head>
<body>
    <div id="wrapper">
        <div id="page-wrapper" >
          	<div id="page-inner">
			 	<div class="row">
                    <div class="col-md-12">
                        <h1 class="page-header">
                           Experience Ticket <small>management</small>
                        </h1>
                    </div>
              	</div> 
            	<div class="row">
                	<div class="col-md-12">
                    	<div class="panel panel-default">
                        	<div class="panel-heading">
                             		体验券信息
                        	</div>
                        	<form action="experience" method="POST" id="queryForm">
                        	<div>
                       			<p>
                       			 	<span>活动名称：</span><span><input type="text" name="activityName" value="${dto.activityName}"/></span>
                    			 	<span>商家名称：<input type="text" name="businessName" value="${dto.businessName}" /></span>
                    				<span>体验券类型：<select  name="ticketType" >
                    					            <option value = ""> </option>
                    								<option value = "0">必送</option>
                    								<option value = "1">随机送</option>
                    								<option value = "2">认证送</option>
                    							  </select></span>                       				
                    				<input type="button" value="查询" onclick="setPageNo(1)">
                    				<input type="reset" value="重置">
                       			</p>
                        	</div>
                        <shiro:hasPermission name="experience:create"> 	
    							<a href="${pageContext.request.contextPath}/experience/create">新增体验券</a><br/>
						 	</shiro:hasPermission>  
                      		<div class="panel-body">
                            	<div class="table-responsive">
                                	<table class="table table-striped table-bordered table-hover" id="dataTables-example">
	                                    <thead>
	                                        <tr>
	                                            <th>活动名称</th>
	                                            <th>活动开始时间</th>
	                                            <th>活动结束时间</th>
	                                            <th>商家名称</th>
	                                            <th>商家电话</th> 
	                                            <th>体验券数量</th>
	                                            <th>已使用数量</th>
	                                            <th>体验券类型</th>
 	                                        	<th>适用人群</th> 
 	                                        	<th>类型</th>
 	                                        	<th>序列号</th>
												<th>html地址</th>
	                                            <th>详情</th>
	                                        </tr>
	                                    </thead>
                                    	<tbody>
		                                    <c:forEach items="${page.results}" var="exp">
		                                        <tr class="odd gradeX">
		                                            <td class="center"><a href="${pageContext.request.contextPath}/experience/${exp.id}/update">${exp.activityName}</a></td>
<%-- 		                                            <td><fmt:formatDate value="${exp.activityStartTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
 --%>		                                            <td>${exp.activityStartTime}</td>
		                                            <td>${exp.activityOverTime}</td>		                                            
		                                            <td>${exp.businessName}</td>
		                                            <td>${exp.businessPhone}</td>
		                                            <td>${exp.ticketCount}</td>
		                                            <td>${exp.ticketAlreadyCount}</td>
		                                            <td>
		                                            <c:choose> 
		                                            <c:when test="${exp.ticketType == 0}">
		                                            	必送			
		                                            </c:when>
                                            		<c:when test="${exp.ticketType == 1}">
                                            			随机送
                                            		</c:when>
                                            		<c:when test="${exp.ticketType == 2}">
                                            			认证送
                                            		</c:when>
                                            		<c:otherwise>                       
                                            		</c:otherwise>
                                            		</c:choose> 
		                                            </td>
		                                            <td>
		                                            <c:choose> 
		                                            <c:when test="${exp.userRole == 0}">
		                                            	无限制			
		                                            </c:when>
                                            		<c:when test="${exp.userRole == 1}">
                                            			男
                                            		</c:when>
                                            		<c:when test="${exp.userRole == 2}">
                                            			女
                                            		</c:when>
                                            		<c:otherwise>                       
                                            		</c:otherwise>
                                            		</c:choose>
                                            		</td>
                                            		 <td>
		                                            <c:choose> 
		                                            <c:when test="${exp.type == 0}">
		                                            	普通			
		                                            </c:when>
                                            		<c:when test="${exp.type == 1}">
                                            			活动
                                            		</c:when>
                                            		<c:otherwise>                       
                                            		</c:otherwise>
                                            		</c:choose>
                                            		</td>
                                            			<td>${exp.sequence }</td>
														<td>${exp.activityUrl}</td>
		                                            <td>
		                                           	<shiro:hasPermission name="experience:update">   
                        								<a href="${pageContext.request.contextPath}/experience/manager?id=${exp.id}">报名管理</a>
                    							 	</shiro:hasPermission>
								                       <shiro:hasPermission name="experience:delete"> 
								                        <a href="${pageContext.request.contextPath}/experience/${exp.id}/delete">删除</a>
								                  </shiro:hasPermission>  
		                                            </td>
		                                            					                
		                                        </tr>
		                                     </c:forEach>
                                    	</tbody>
                                	</table>
                            	</div>
                        	</div>
                        	<p align="right"><page:page page="${page}"/></p>
				            </form>
                    	</div>
                	</div>
				</div>
        	</div>
	    </div>
	</div>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery-1.10.2.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/dataTables/jquery.dataTables.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/dataTables/dataTables.bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/custom-scripts.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/page.js"></script>
    <script>
          $(document).ready(function () {
              /*$('#dataTables-example').dataTable();*/
          });
  	</script>
</body>
</html>
